<template>
  <div>
    <upload-excel :on-success="handleSuccess" />
  </div>
</template>

<script>
import { importEmployee } from '@/api/employees'
import { getImportData } from '@/utils/excelData'
export default {
  data() {
    return {

    }
  },
  methods: {
    // excel解析完毕自动调用的回调函数
    async handleSuccess({ header, results }) {
      // 处理数据
      const newArr = getImportData(results)
      // 调用导入接口
      console.log(newArr)
      await importEmployee(newArr)
      this.$router.back()
    }
  }
}
</script>

<style>

</style>
